#ifndef MAININTERFACE_H
#define MAININTERFACE_H

#include "./module/iconwidgetfeature.h"
#include "./module/iconthemewidget.h"
#include "./module/globalthemewidget.h"
#include "./module/cursorthemewidget.h"
#include "./module/infocreatewidget.h"
#include "./module/plymouththemewidget.h"
#include "./module/grubthemewidget.h"

#include "titlebar.h"
#include "./module/cacheconfirmedwidget.h"
#include "./module/historywidget.h"
#include "./module/basewidget.h"

#include <QWidget>
#include <QPushButton>
#include <QVBoxLayout>
#include <QButtonGroup>
#include <QPainter>
#include <QScrollArea>
#include <QLabel>
#include <QMap>
#include <QDebug>
#include <QFileDialog>
#include <QStackedWidget>


class MainInterface : public QWidget
{
    Q_OBJECT
public:
    explicit MainInterface(QWidget *parent = nullptr);
    void isHistory(bool ishistory);
    void setIconTheme();
    void setGlobalTheme();
    void setCursorTheme();
    void setPlymouthTheme();
    void setGrubTheme();

    void getThemeInfo(const HistoryInfo &InfoData);
    void updateButtonGroup(bool isGlobalTheme);
    void updateThumbnail(QString thumbnailPath);
    //初始化和刷新时使用
    QMap<QString, QString>* getAppIconsMap();
    QMap<QString, QString>* getSystemIconsMap();
    QMap<QString, QString>* getCurosrMap();
    QMap<QString, QString>* getTimeCurosrMap();

    void refresh(QString themeType);

    void startShowPlymouth();
signals:
    void wallpaperupdate(const QString& filePath);
    void wallpaperPathChanged(QString path);
    void coverPathChanged(QString path);
    void radiusChanged(int radius);
    void transparencyChanged(int transparency);
    void windowRadiusChanged(int windowRadius);
    void accentColorChanged(QColor accentcolor);
    void exteriorChanged(QColor exteriorcolor);
    void appIconsMapChanged(QMap<QString, QString> *appiconsmap);
    void systemIconsMapChanged(QMap<QString, QString> *systemiconsmap);
    void cursorMapChanged(QMap<QString, QString> *appiconsmap);
    void timeCursorMapChanged(QMap<QString, QString> *systemiconsmap);
    void plymouthPathChanged(QString path);
    void grubPathChanged(QString path);
    void deleteIcon(QString widgetName);
    void refreshPlymouthDir();
    void startCopy();
    void gohomesignals();
    void globalthemeChange(QMap<QString, bool> *globalthemeChangeMap);
    void iconthemeChange(QMap<QString, bool> *iconthemeChangeMap);
    void cursorthemeChange(QMap<QString, bool> *cursorthemeChangeMap);
private:
    void init();
    void initLeftBar();

    bool m_ishistory = false;
    QMap<QString, QString> *m_iconpathmap;

    IconThemeWidget *m_iconthemewidget;
    GlobalThemeWidget *m_globalthemewidget;
    CursorThemeWidget *m_cursorthemewidget;
    PlymouthThemeWidget *m_plymouththemewidget;
    GrubThemeWidget *m_grubthemewidget;
    QStackedWidget *m_themestackedwidget;
    InfoCreateWidget *m_info;

    QHBoxLayout *m_layout;
    BaseLeftWidget *m_navigationwidget;

    TypeButton *m_globalbtn;
    TypeButton *m_iconbtn;
    TypeButton *m_cursorbtn;
    TypeButton *m_plymouthbtn;
    TypeButton *m_grubbtn;
    QPushButton *m_buildbtn;
    QWidget *m_belowwidget;

};

#endif // MAININTERFACE_H
